<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<tiles:insert page="/general/templateLoggedIn.jsp">
	<tiles:put name="title" value="Graded Applications"/>
	<tiles:put name="nav"/>
	<tiles:put name="content" type="string">

		<h2>Ungraded Applications of <c:out value="${requestScope.reviewer}"/></h2>
		
		<table class="border">
			<tr>
				<th>
					First Name
				</th>
				<th>
					Name
				</th>
				<th>
					Status
				</th>
				<th>
					Options
				</th>
			</tr>
			<c:forEach var="ungraded" items="${requestScope.ungraded}">
				<tr class="evenHover">
					<td>
						${ungraded.firstName}
					</td>
					<td>
						${ungraded.name}
					</td>
					<td>
						${ungraded.applicationStatus}
					</td>
					<td>
						<c:choose>
							<c:when test="${ungraded.applicationStatus eq 'Pending'}">
								<html:link action="/decision">
									<html:param name="decision" value="accept"/>
									<html:param name="applicant" value="${ungraded.mail}"/>
									<html:param name="section" value="ungraded"/>
									<html:param name="reviewer" value="${requestScope.reviewer}"/>
									<img src='<html:rewrite page="/res/img/accept.png"/>' alt="Accept">
								</html:link>
								
								<html:link action="/decision">
									<html:param name="decision" value="reject"/>
									<html:param name="applicant" value="${ungraded.mail}"/>
									<html:param name="section" value="ungraded"/>
									<html:param name="reviewer" value="${requestScope.reviewer}"/>
									<img src='<html:rewrite page="/res/img/reject.png"/>' alt="Reject">
								</html:link>
							</c:when>
							<c:when test="${ungraded.applicationStatus eq 'Accepted'}">
								<html:link action="/decision">
									<html:param name="decision" value="reject"/>
									<html:param name="applicant" value="${ungraded.mail}"/>
									<html:param name="section" value="ungraded"/>
									<html:param name="reviewer" value="${requestScope.reviewer}"/>
									<img src='<html:rewrite page="/res/img/reject.png"/>' alt="Reject">
								</html:link>
								
								<html:link action="/decision">
									<html:param name="decision" value="cancel"/>
									<html:param name="applicant" value="${ungraded.mail}"/>
									<html:param name="section" value="ungraded"/>
									<html:param name="reviewer" value="${requestScope.reviewer}"/>
									<img src='<html:rewrite page="/res/img/cancel-decision.png"/>' alt="Cancel Decision">
								</html:link>
							</c:when>
							<c:when test="${ungraded.applicationStatus eq 'Rejected'}">
								<html:link action="/decision">
									<html:param name="decision" value="accept"/>
									<html:param name="applicant" value="${ungraded.mail}"/>
									<html:param name="section" value="ungraded"/>
									<html:param name="reviewer" value="${requestScope.reviewer}"/>
									<img src='<html:rewrite page="/res/img/accept.png"/>' alt="Accept">
								</html:link>
								
								<html:link action="/decision">
									<html:param name="decision" value="cancel"/>
									<html:param name="applicant" value="${ungraded.mail}"/>
									<html:param name="section" value="ungraded"/>
									<html:param name="reviewer" value="${requestScope.reviewer}"/>
									<img src='<html:rewrite page="/res/img/cancel-decision.png"/>' alt="Cancel Decision">
								</html:link>
							</c:when>
						</c:choose>
					</td>
				</tr>
			</c:forEach>
		</table>
	</tiles:put>
</tiles:insert>	